{#
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    # http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
-#}
{% extends "base.html" %}
{% block title %}
  {% if form.errors %}
    {% trans %}Error processing form{% endtrans %} -
  {% endif %}
  {% trans %}Confirm password{% endtrans %}
{% endblock %}
{# These pages are not indexed so the canonical URL doesn't matter #}
{% block canonical_url %}{% endblock %}
{% block content %}
  {% if testPyPI %}
    {% set title = "TestPyPI" %}
  {% else %}
    {% set title = "PyPI" %}
  {% endif %}
  <div class="horizontal-section">
    <div class="site-container">
      <h1 class="page-title">{% trans title=title %}Confirm password to continue{% endtrans %}</h1>
      <form method="post"
            action="{{ request.route_path('accounts.reauthenticate') }}">
        <input name="csrf_token"
               type="hidden"
               value="{{ request.session.get_csrf_token() }}">
        {{ form.next_route }}
        {{ form.next_route_matchdict }}
        {{ form.next_route_query }}
        {{ form.username }}
        {% if form.form_errors %}
          <ul class="form-errors" role="alert">
            {% for error in form.form_errors %}<li>{{ error }}</li>{% endfor %}
          </ul>
        {% endif %}
        <div data-controller="password" class="form-group">
          <div>
            <label for="password" class="form-group__label">
              {% trans %}Password{% endtrans %}
              {% if form.password.flags.required %}
                <span class="form-group__required">{% trans %}(required){% endtrans %}</span>
              {% endif %}
            </label>
          </div>
          {{ form.password(placeholder=gettext("Your password") ,
          required="required",
          class_="form-group__field",
          autocomplete="current-password",
          spellcheck="false",
          data_password_target="password",
          aria_describedby="password-errors",
          ) }}
          <div id="password-errors">
            {% if form.password.errors %}
              <ul class="form-errors" role="alert">
                {% for error in form.password.errors %}<li>{{ error }}</li>{% endfor %}
              </ul>
            {% endif %}
          </div>
          <div class="form-group">
            <div class="split-layout margin-top--large margin-bottom--large">
              <div>
                <input type="submit"
                       value="{% trans %}Confirm password{% endtrans %}"
                       class="button button--primary">
              </div>
              <label for="show-password">
                <input data-action="change->password#togglePasswords"
                       data-password-target="showPassword"
                       id="show-password"
                       type="checkbox">
                &nbsp;{% trans %}Show password{% endtrans %}
              </label>
            </div>
            <span>
              <a href="{{ request.route_url('accounts.request-password-reset') }}">{% trans %}Forgot password?{% endtrans %}</a>
            </span>
          </div>
          <span>
            {% trans href=request.help_url(_anchor="sensitiveactions") %}
            <b>Tip:</b> you are about to perform a <a href="{{ href }}">sensitive action</a>.
            If you are not on a personal computer, make sure to log out once you're done with your session.
            We won't ask you to confirm your password again for the next hour.
          {% endtrans %}
        </span>
      </div>
    </form>
  </div>
</div>
{% endblock %}
